package com.cgly.medical.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @program: CGLY
 * @description: 定时发送邮件任务
 * @author: chen di
 * @create: 2022-08-23 15:22
 */
@Component
public class EmailSchedulerTask {

    @Autowired
    private MailClient mailClient;

    @Value("${spring.mail.username}")
    public String to ;
    public String filePathExcel;
    public String filePathPdf;

    /**
     * 每天凌晨00:02分执行，corn表达式可根据自己需求定义
     */
//    @Scheduled(cron="0/10 * * * * ? ") //查看连接设置corn表达式
    private void processDay() throws Exception {

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

        String emailContent = formatter.format(new Date())+" 日报表";
//        mailClient.sendHtmlMail(to,formatter.format(new Date())+"日报表",emailContent, filePathExcel,filePathPdf);
        System.out.println(emailContent);

    }

}